package www.bplead.com.mydemo.activity;

import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import www.bplead.com.mydemo.R;

/**
 * Created by wangyangzi on 2016/9/22.
 */
public class AnimationActivity extends AppCompatActivity implements View.OnClickListener {
    private static final String TAG = "AnimationActivity";

    ImageView imageView;
    Button moveBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.property_animate);

        imageView = (ImageView) this.findViewById(R.id.haizeiwang);
        moveBtn = (Button) this.findViewById(R.id.move_animate_btn);
        moveBtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.move_animate_btn:
                ObjectAnimator.ofFloat(imageView,"translationX",0F,200F).setDuration(500).start();
                ObjectAnimator.ofFloat(imageView,"rotation",0F,180F).setDuration(500).start();
                break;
        }
    }
}
